//
//  RadioplaylistCell.m
//  SunXi
//
//  Created by dllo on 15/11/28.
//  Copyright © 2015年 大远. All rights reserved.
//

#import "RadioplaylistCell.h"

@implementation RadioplaylistCell
{
    UIImageView *_imageView;
    UILabel *_title;
    UILabel *_userlabel;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self create];
    }
    return self;
}
- (void)create{
    
    _imageView = [[UIImageView alloc]init];
    [SCV addSubview:_imageView];
    
    
    _title = [[UILabel alloc]init];
    [SCV addSubview:_title];
    
    
    _userlabel = [[UILabel alloc]init];
    [SCV addSubview:_userlabel];
    
    
}

- (void)layoutSubviews{
    [super layoutSubviews];
    [_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.left.equalTo(self);
        make.height.equalTo(self);
        make.width.mas_equalTo(8);
    }];
    _imageView.backgroundColor = BUTTONCOLOR;
    
    if (self.now) {
        _imageView.hidden = NO;
    }else{
        _imageView.hidden = YES;
    }
    
    [_title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(5);
        make.left.equalTo(_imageView.mas_right).offset(5);
        make.size.mas_equalTo(CGSizeMake(500, 20));
    }];
    _title.text = self.model.title;
    _title.font = [UIFont systemFontOfSize:15];
    
    
    
    [_userlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self).offset(-2);
        make.left.equalTo(_imageView.mas_right).offset(5);
        make.size.mas_equalTo(CGSizeMake(200, 20));

    }];
    
    _userlabel.text = [NSString stringWithFormat:@"by:%@",self.model.userinfo[@"userinfo"][@"uname"]];
    if (self.model.userinfo[@"userinfo"][@"uname"] == nil) {
       _userlabel.text = [NSString stringWithFormat:@"by:%@",self.model.userinfo[@"uname"]];
    }
    _userlabel.font = [UIFont systemFontOfSize:13];
    _userlabel.textColor =[UIColor colorWithRed:0.503 green:0.513 blue:0.531 alpha:0.800];
    
    
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
